/**
 * show descriptions
 * @author William
 * 2012-1-14
 */
package com.ytu.irss;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class ShowDetailsActivity extends Activity {

	@Override
	public void onCreate(Bundle b) {
		super.onCreate(b);
		setContentView(R.layout.showdesc);
		String content = null;
		Intent startingIntent = getIntent();

		if (startingIntent != null) {

			Bundle bundle = startingIntent.getBundleExtra("rssItem");

			if (bundle == null) {
				content = "不好意思，出错了！";
			} else {
				if (bundle.getString("title") != null)
					content = bundle.getString("title") + "\n\n";
				else
					content += "<No Title>";
				if (bundle.getString("pubDate") != null)
					content += bundle.getString("pubDate") + "\n\n";
				else
					content += "<NO pubDate>";
				if (bundle.getString("description") != null)
					content += bundle.getString("description");
				else
					content += "<no description>";
				if (bundle.getString("link") != null)
					content += "\n\n详细信息可访问：\n" + bundle.getString("link");

			}
		} else {
			content = "不好意思，出错了！";
		}

		TextView tv = (TextView) findViewById(R.id.contents);
		tv.setText(content);

		Button backButton = (Button) findViewById(R.id.back);

		backButton.setOnClickListener(new Button.OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}

		});
	}

}
